package com.antd.auth.handler;

import com.antd.common.auth.util.AntdSecurityUtil;
import com.antd.common.core.util.R;
import lombok.extern.slf4j.Slf4j;
import org.springframework.security.core.Authentication;
import org.springframework.security.web.authentication.logout.LogoutSuccessHandler;
import org.springframework.stereotype.Component;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * TODO
 *
 * @author 子丶沫
 * @version 1.0
 * @date 2020/11/23 16:50
 */
@Component
@Slf4j
public class AntdLogoutSuccessHandler implements LogoutSuccessHandler {
    @Override
    public void onLogoutSuccess(HttpServletRequest request, HttpServletResponse response, Authentication authentication) throws IOException, ServletException {
        AntdSecurityUtil.writeJavaScript(R.ok("退出登录!"), response);
    }
}
